package com.easyJava.bean;

import com.easyJava.utils.PropertiesUtils;


public class Constants {
    public static boolean IGNORE_TABLE_PREFIX;

    public static String SUFFIX_BEAN_QUERY;
    public static String SUFFIX_BEAN_QUERY_FUZZY;
    public static String SUFFIX_BEAN_QUERY_TIME_START;
    public static String SUFFIX_BEAN_QUERY_TIME_END;
    public static String SUFFIX_MAPPER;
    public static String SUFFIX_SERVICE;
    public static String SUFFIX_SERVICE_IMPL;
    public static String SUFFIX_CONTROLLER;


    public static String PATH_BASE;
    public static String PATH_JAVA;
    public static String PATH_RESOURCE;
    public static String PATH_PO;
    public static String PATH_VO;
    public static String PATH_QUERY;
    public static String PATH_UTILS;
    public static String PATH_MAPPER_XML;
    public static String PATH_MAPPER;
    public static String PATH_ENUMS;
    public static String PATH_SERVICE;
    public static String PATH_SERVICE_IMPL;
    public static String PATH_RESULT;
    public static String PATH_CONTROLLER;

    public static String PACKAGE_BASE;
    public static String PACKAGE_PO;
    public static String PACKAGE_VO;
    public static String PACKAGE_QUERY;
    public static String PACKAGE_UTILS;
    public static String PACKAGE_MAPPER;
    public static String PACKAGE_ENUMS;
    public static String PACKAGE_SERVICE;
    public static String PACKAGE_SERVICE_IMPL;
    public static String PACKAGE_RESULT;
    public static String PACKAGE_CONTROLLER;


    public static String[] IGNORE_FIELDS;
    public static String IGNORE_FIELD_EXPRESSION;
    public static String IGNORE_FIELD_PACKAGE;

    public static String DATE_FORMAT_EXPRESSION;
    public static String DATE_FORMAT_PACKAGE;

    public static String DATE_JSON_FORMAT_EXPRESSION;
    public static String DATE_JSON_FORMAT_PACKAGE;

    static {
        IGNORE_TABLE_PREFIX = Boolean.parseBoolean(PropertiesUtils.getProperties("ignore.table.prefix"));

        SUFFIX_BEAN_QUERY = PropertiesUtils.getProperties("suffix.bean.query");
        SUFFIX_BEAN_QUERY_FUZZY = PropertiesUtils.getProperties("suffix.bean.query.fuzzy");
        SUFFIX_BEAN_QUERY_TIME_START = PropertiesUtils.getProperties("suffix.bean.query.time.start");
        SUFFIX_BEAN_QUERY_TIME_END = PropertiesUtils.getProperties("suffix.bean.query.time.end");
        SUFFIX_MAPPER = PropertiesUtils.getProperties("suffix.mapper");
        SUFFIX_SERVICE = PropertiesUtils.getProperties("suffix.service");
        SUFFIX_SERVICE_IMPL = PropertiesUtils.getProperties("suffix.service.impl");
        SUFFIX_CONTROLLER = PropertiesUtils.getProperties("suffix.controller");

        PATH_BASE = PropertiesUtils.getProperties("path.base");
        PATH_JAVA = PATH_BASE + "java/" + PropertiesUtils.getProperties("package.base").replace('.', '/') + "/";
        PATH_RESOURCE = PATH_BASE + "resources/";

        PATH_PO = PATH_JAVA + PropertiesUtils.getProperties("package.po").replace('.', '/');
        PATH_VO = PATH_JAVA + PropertiesUtils.getProperties("package.vo").replace('.', '/');
        PATH_QUERY = PATH_JAVA + PropertiesUtils.getProperties("package.query").replace('.', '/');
        PATH_UTILS = PATH_JAVA + PropertiesUtils.getProperties("package.utils").replace(".", "/");
        PATH_MAPPER = PATH_JAVA + PropertiesUtils.getProperties("package.mapper").replace('.', '/');
        PATH_MAPPER_XML = PATH_RESOURCE + PropertiesUtils.getProperties("package.base").replace('.', '/') + "/" + PropertiesUtils.getProperties("package.mapper").replace('.', '/');
        PATH_ENUMS = PATH_JAVA + PropertiesUtils.getProperties("package.enums").replace('.', '/');
        PATH_SERVICE = PATH_JAVA + PropertiesUtils.getProperties("package.service").replace('.', '/');
        PATH_SERVICE_IMPL = PATH_JAVA + PropertiesUtils.getProperties("package.service.impl").replace('.', '/');
        PATH_RESULT = PATH_JAVA + PropertiesUtils.getProperties("package.result").replace('.', '/');
        PATH_CONTROLLER = PATH_JAVA + PropertiesUtils.getProperties("package.controller").replace('.', '/');

        PACKAGE_BASE = PropertiesUtils.getProperties("package.base");
        PACKAGE_PO = PACKAGE_BASE + "." + PropertiesUtils.getProperties("package.po");
        PACKAGE_VO = PACKAGE_BASE + "." + PropertiesUtils.getProperties("package.vo");
        PACKAGE_QUERY = PACKAGE_BASE + "." + PropertiesUtils.getProperties("package.query");
        PACKAGE_UTILS = PACKAGE_BASE + "." + PropertiesUtils.getProperties("package.utils");
        PACKAGE_MAPPER = PACKAGE_BASE + "." + PropertiesUtils.getProperties("package.mapper");
        PACKAGE_ENUMS = PACKAGE_BASE + "." + PropertiesUtils.getProperties("package.enums");
        PACKAGE_SERVICE = PACKAGE_BASE + "." + PropertiesUtils.getProperties("package.service");
        PACKAGE_SERVICE_IMPL = PACKAGE_BASE + "." + PropertiesUtils.getProperties("package.service.impl");
        PACKAGE_RESULT = PACKAGE_BASE + "." + PropertiesUtils.getProperties("package.result");
        PACKAGE_CONTROLLER = PACKAGE_BASE + "." + PropertiesUtils.getProperties("package.controller");


        IGNORE_FIELDS = PropertiesUtils.getProperties("ignore.field")==null?null:PropertiesUtils.getProperties("ignore.field").split(",");
        IGNORE_FIELD_EXPRESSION = PropertiesUtils.getProperties("ignore.field.expression");
        IGNORE_FIELD_PACKAGE = PropertiesUtils.getProperties("ignore.field.package");

        DATE_FORMAT_EXPRESSION = PropertiesUtils.getProperties("date.format.expression");
        DATE_FORMAT_PACKAGE = PropertiesUtils.getProperties("date.format.package");

        DATE_JSON_FORMAT_EXPRESSION = PropertiesUtils.getProperties("date.json.format.expression");
        DATE_JSON_FORMAT_PACKAGE = PropertiesUtils.getProperties("data.json.format.package");

    }

    public static final String[] SQL_DATE_TIME_TYPE = {"datetime", "timestamp"};
    public static final String[] SQL_DATE_TYPE = {"date"};
    public static final String[] SQL_DECIMAL_TYPE = {"decimal", "double", "float"};
    public static final String[] SQL_STRING_TYPE = {"char", "varchar", "text", "mediumtext", "longtext"};
    public static final String[] SQL_INTEGER_TYPE = {"int", "tinyint"};
    public static final String[] SQL_LONG_TYPE = {"bigint"};

    public static final String FILE_SUFFIX_JAVA = ".java";
    public static final String FILE_SUFFIX_XML = ".xml";

}
